package com.openbravo.pos.model;

import java.net.MalformedURLException;

import cn.ekuma.data.dao.I_DataLogic;
import cn.ekuma.epos.datalogic.I_DataLogicAdmin;
import cn.ekuma.epos.datalogic.I_DataLogicCustomers;
import cn.ekuma.epos.datalogic.I_DataLogicERP;
import cn.ekuma.epos.datalogic.I_DataLogicReceipts;
import cn.ekuma.epos.datalogic.I_DataLogicSales;
import cn.ekuma.epos.datalogic.I_DataLogicSystem;
import cn.ekuma.epos.datalogic.hessian.HessianDataLogicHelper;
import cn.ekuma.epos.module.AbstractPosModel;
import cn.ekuma.security.datalogic.I_DataLogicSecurity;

import com.openbravo.data.basic.BasicException;

public class HessianDataLogicModel extends AbstractPosModel {
	
	public final static String NAME="com.openbravo.pos.model.HessianDataLogicModel";

	protected  I_DataLogicERP dlERP;
	protected  I_DataLogicSales dlSales;
	protected  I_DataLogicReceipts dlReceipts;
	protected  I_DataLogicSystem dlSystem;
	protected  I_DataLogicAdmin dlAdmin;
	protected  I_DataLogicCustomers dlCustomers;
	protected  I_DataLogicSecurity dlSecurity;
	
	@Override
	public String getModelName() {
		return NAME;
	}

	@Override
	public String getModelDescription() {
		return "the base datalogic default";
	}

	@Override
	public String getVersion() {
		return "1.0";
	}
	
	
	public void setup(String addr) throws BasicException{
		try {
			HessianDataLogicHelper.init(addr);
		} catch (MalformedURLException e) {
			throw new BasicException(e);
		}
		dlSystem = (I_DataLogicSystem) getBean("cn.ekuma.epos.datalogic.hessian.HessianDataLogicSystem");
        dlERP=(I_DataLogicERP) getBean("cn.ekuma.epos.datalogic.hessian.HessianDataLogicERP");
        dlSales=(I_DataLogicSales) dlERP;
        dlAdmin=(I_DataLogicAdmin) getBean("cn.ekuma.epos.datalogic.hessian.HessianDataLogicAdmin");
        dlCustomers=(I_DataLogicCustomers) getBean("cn.ekuma.epos.datalogic.hessian.HessianDataLogicCustomers");		
        dlReceipts=(I_DataLogicReceipts) getBean("cn.ekuma.epos.datalogic.hessian.HessianDataLogicReceipts");
        dlSecurity=(I_DataLogicSecurity)getBean("cn.ekuma.epos.datalogic.hessian.HessianDataLogicSecurity");
	}

	public  I_DataLogicERP getDLERP(){
		return dlERP;
	}
	
	public  I_DataLogicSales getDLSales(){
		return dlSales;
	}
	
	public  I_DataLogic  getDataLogic(){
		return dlERP;
	}
	
	public  I_DataLogicReceipts getDLReceipts(){
		return dlReceipts;
	}
	
	public  I_DataLogicSystem getDLSystem(){
		return dlSystem;
	}
	
	public  I_DataLogicAdmin getDLAdmin(){
		return dlAdmin;
	}
	
	public  I_DataLogicCustomers getDLCustomer(){
		return dlCustomers;
	}

	public I_DataLogicSecurity getDLSecurity() {
		return dlSecurity;
	}

}